package com.xiao.mall.message.rabbitmq.repository;

import com.xiao.mall.foundation.repository.BaseRepository;
import com.xiao.mall.message.domain.Notification;
import com.xiao.mall.message.domain.UserNotification;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface UserNotificationRepository extends BaseRepository<UserNotification, Long> {

    Optional<UserNotification> findByNotificationAndUserIdEqualsOrderByCreatedDateDesc(Notification notification, String userId);

    List<UserNotification> findAllByUserIdIn(List<String> mergeUserIds);

    List<UserNotification> findAllByUserId(String mergeUserId);

//    @Modifying
//    @Query("update UserNotification  set userId =:userId where userId=: fromUserId ")
//    void  updateByUserId(@Param("userId") String userId,
//                         @Param("fromUserId") String fromUserId);
}
